<form id="order" name="order" method="post">
	<table class="formTable" border="0" cellpadding="0" cellspacing="0">
		<tr class="smallTitle"><td colspan=2>第一步：填写基本信息</td></tr>
		<tr>
			<th width="150"><label for="from_id"><tt id="from_id_name">订单来源</tt></label>：</th>
			<td>
				<select id="from_id" name="customer[from_id]" class="input">
				<?php if (isset($froms))
					foreach ($froms as $item) {
						echo '<option value="'.$item['id'].'">'.$item['name'].'</option>';
					}
				?>
				</select>
				<div id="from_id_tip" class="tip_default">请选择订单来源.</div>
			</td>
		</tr>
		<tr>
			<th width="150"><label for="number"><tt id="number_name">订单编号</tt></label>：</th>
			<td>
				<span id="number_value" style="width:150px;" tp=number:{type:'text',validator:['code','exist:<?php echo site_url('order/order/existNumber')?>']}><?php if(isset($o)) echo $o['number'];?></span>
				<div id="number_tip">填写订单编号.</div>
			</td>
		</tr>
		<tr>
			<th width="150"><label for="username"><tt id="username_name">会员名</tt></label>：</th>
			<td>
				<span id="username_value" style="width:150px;" tp=username:{type:'text',name:'customer[username]',validator:['empty','username']}><?php if(isset($customer)) echo $customer['username'];?></span>
				<div id="username_tip">填写会员名.</div>
			</td>
		</tr>
		<tr>
			<th width="150"><label for="realname"><tt id="realname_name">真实姓名</tt></label>：</th>
			<td>
				<span id="realname_value" style="width:150px;" tp=realname:{type:'text',name:'customer[realname]',validator:['realname']}><?php if(isset($customer)) echo $customer['realname'];?></span>
				<div id="realname_tip">填写真实姓名(收件人姓名).</div>
			</td>
		</tr>
		<tr>
			<th width="150"><label for="address"><tt id="address_name">发货地址</tt></label>：</th>
			<td>
				<span id="address_value" style="width:400px;height:40px;" tp=address:{type:'textarea',name:'customer[address]',validator:['address']}><?php if(isset($customer)) echo $customer['address'];?></span>
				<div id="address_tip">填写发货地址.</div>
			</td>
		</tr>
		<tr>
			<th width="150"><label for="postcode"><tt id="postcode_name">邮编</tt></label>：</th>
			<td>
				<span id="postcode_value" style="width:150px;" tp=postcode:{type:'text',name:'customer[postcode]',validator:['empty','postcode']}><?php if(isset($customer)) echo $customer['postcode'];?></span>
				<div id="postcode_tip">填写邮编.</div>
			</td>
		</tr>
		<tr>
			<th width="150"><label for="mobile"><tt id="mobile_name">手机</tt></label>：</th>
			<td>
				<span id="mobile_value" style="width:150px;" tp=mobile:{type:'text',name:'customer[mobile]',validator:['empty','mobile']}><?php if(isset($customer)) echo $customer['mobile'];?></span>
				<div id="mobile_tip">填写手机号码.</div>
			</td>
		</tr>
		<tr>
			<th width="150"><label for="phone"><tt id="phone_name">电话</tt></label>：</th>
			<td>
				<span id="phone_value" style="width:150px;" tp=phone:{type:'text',name:'customer[phone]',validator:['empty','phone']}><?php if(isset($customer)) echo $customer['phone'];?></span>
				<div id="phone_tip">填写电话号码.</div>
			</td>
		</tr>
		<tr>
			<th width="150"><label for="email"><tt id="email_name">Email</tt></label>：</th>
			<td>
				<span id="email_value" style="width:150px;" tp=email:{type:'text',name:'customer[email]',validator:['empty','email']}><?php if(isset($customer)) echo $customer['email'];?></span>
				<div id="email_tip">填写邮箱.</div>
			</td>
		</tr>
		<tr>
			<th width="150"><label for="express_id"><tt id="express_id_name">发货快递</tt></label>：</th>
			<td>
				<select id="express_id" name="express_id" class="input">
					<option value="0">那个便宜发那个</option>
				<?php if (isset($expresses))
					foreach ($expresses as $item) {
						echo '<option value="'.$item['id'].'">'.$item['name'].'</option>';
					}
				?>
				</select>
				<div id="express_id_tip" class="tip_default">请选择发货快递.</div>
			</td>
		</tr>
		<tr>
			<th width="150"><label for="invoice"><tt id="invoice_name">发票抬头</tt></label>：</th>
			<td>
				<span id="invoice_value" style="width:400px;" tp="invoice:{type:'text',validator:['empty','realname']}"><?php if(isset($o)) echo $o['invoice'];?></span>
				<div id="invoice_tip">填写发票抬头，如果不开发票不需要填写.</div>
			</td>
		</tr>
		<tr>
			<th width="150"><label for="remark"><tt id="remark_name">订单备注</tt></label>：</th>
			<td>
				<span id="remark_value" style="width:400px;height:40px;" tp="remark:{type:'textarea'}"><?php if(isset($o)) echo $o['remark'];?></span>
				<div id="remark_tip">填写订单备注.</div>
			</td>
		</tr>
	</table>
	<input class="button" type="submit" value="保存" />
	<?php if(isset($o)) echo '<input name="id" value="'.$o->id.'" type="hidden"/><input id="backList" class="button" type="button" value="取消" title="返回列表" />'?>
	<?php if(isset($add_order_product) && $add_order_product){?>
		<input name="customer[id]" value="<?php echo $customer['id']?>"/>
	<?php }?>
</form>
<script type="text/javascript">
	$(function(){
		<?php if(isset($action)){?>
			new plugor.form({formid:'order',method:'POST',action:'<?php echo site_url('order/order/'.$action);?>',submit:'ajax'})
		<?php }else{?>
			new plugor.form({formid:'order',method:'POST',action:'<?php echo site_url('order/order/add');?>',submit:'ajax'})
		<?php }?>
	});
</script>